package com.proxy.dao;

import java.util.Date;

import com.proxy.util.Constants;

/**
 * Proxy value object
 *
 */
public class Proxy {
	
	private String hostname = "";
	private int port = Constants.PORT_80;
	private String schemeName = Constants.HTTP_SCHEME;
	private String proxy;
	private boolean validForGoogleHost = false;
	private boolean validForOtherHost = false;
	private Date updateTimeForGoogleHost;
	private Date updateTimeForOtherHost;
	
	public String getHostname() {
		return hostname;
	}
	public void setHostname(String hostname) {
		this.hostname = hostname;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	public String getSchemeName() {
		return schemeName;
	}
	public void setSchemeName(String schemeName) {
		this.schemeName = schemeName;
	}
	public String getProxy() {
		return proxy;
	}
	public void setProxy(String proxy) {
		this.proxy = proxy;
		try {
			String [] splitProxy = this.proxy.split(":");
			this.hostname = splitProxy[0];
			this.port = Integer.valueOf(splitProxy[1]);
			this.schemeName = "http";
		} catch (NumberFormatException e) {
			e.printStackTrace();
		}
	}
	public boolean isValidForGoogleHost() {
		return validForGoogleHost;
	}
	public void setValidForGoogleHost(boolean validForGoogleHost) {
		this.validForGoogleHost = validForGoogleHost;
	}
	public boolean isValidForOtherHost() {
		return validForOtherHost;
	}
	public void setValidForOtherHost(boolean validForOtherHost) {
		this.validForOtherHost = validForOtherHost;
	}
	public Date getUpdateTimeForGoogleHost() {
		return updateTimeForGoogleHost;
	}
	public void setUpdateTimeForGoogleHost(Date updateTimeForGoogleHost) {
		this.updateTimeForGoogleHost = updateTimeForGoogleHost;
	}
	public Date getUpdateTimeForOtherHost() {
		return updateTimeForOtherHost;
	}
	public void setUpdateTimeForOtherHost(Date updateTimeForOtherHost) {
		this.updateTimeForOtherHost = updateTimeForOtherHost;
	}

}
